import React, { useState, useEffect } from 'react';

function FriendStatus(props) {

    useEffect(() => {
        localStorage.setItem("FriendStatus", 1111)
        return () => {
            localStorage.setItem("FriendStatus", 2222)
        };
    });

    return localStorage.getItem("FriendStatus");
}

function WrapFriendStatus(props) {

    const [show, setShow] = useState(true);

    return <div>
        <button onClick={() => setShow(!show)}>点我</button>
        {
            show && <FriendStatus></FriendStatus>
        }

    </div>;
}

export default WrapFriendStatus;